
lst = [10, 90, 89, 66, 99, 92, 38, 56]


def quick(lst):
    """快速排序"""
    if len(lst) >1:
        left = []
        right = []
        middle = [lst[0]]
        for i in  range(1, len(lst)):
            if lst[i] < lst[0]:
                left.append(lst[i])
            elif lst[i] > lst[0]:
                right.append(lst[i])
            else:
                middle.append(lst[i])
        return quick(left) + middle + quick(right)
    else:
        return lst


print(quick(lst))

